<style lang="less">
    @import "../../../styles/table.less";
</style>
<template>
    <div class="search">
        <Row>
            <Col>
                <Card>
                    <Row>
                        <Form ref="searchForm" :model="searchForm" inline :label-width="70">
                            <Form-item label="员工名称" prop="userName">
                                <Input type="text" v-model="searchForm.userName" placeholder="请输入员工名称" clearable
                                       style="width: 200px"/>
                            </Form-item>


                            <Form-item style="margin-left:-35px;" class="br">
                                <Button @click="handleSearch" type="primary" icon="ios-search">搜索</Button>


                            </Form-item>
                        </Form>
                    </Row>


                    <Row>
                        <Table :loading="loading" border :columns="columns" :data="data" sortable="custom" ref="table"></Table>
                    </Row>
                    <Row type="flex" justify="end" class="page">
                        <Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize"
                              @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10,20,50]"
                              size="small" show-total show-elevator show-sizer></Page>
                    </Row>
                </Card>
            </Col>
        </Row>
    </div>
</template>
d
<script>
    import circleLoading from "../../my-components/circle-loading.vue";
    import {blacklistList} from "@/api/hr";

    export default {
        name: "blacklist-manage",
        components: {
            circleLoading
        },
        data() {
            return {
                loading: false, // 表单加载状态
                operationLoading: false,
                drop: false,
                selectCount: 0, // 多选计数
                selectList: [], // 多选数据
                dropDownContent: "展开",
                dropDownIcon: "ios-arrow-down",
                searchForm: {
                    pageNumber: 1, // 当前页数
                    pageSize: 10, // 页面大小
                    sort: "createTime", // 默认排序字段
                    order: "desc", // 默认排序方式
                    userName: "",
                    mobile: "",
                    startDate: "",
                    endDate: ""
                },
                selectDate: null, //选择日期绑定modal
                columns: [

                    {
                        type: "index",
                        width: 60,
                        align: "center"
                    }, {
                        title: "头像",
                        key: "avator",
                        width: 100,
                        align: "center",
                        render: (h, params) => {
                            return h("Avatar", {
                                props: {
                                    src: params.row.avator
                                }
                            });
                        }
                    },
                    {
                        title: "员工姓名",
                        key: "userName",
                        width: 200,
                        sortable: true
                    },{
                        title: "企业名称",
                        key: "compName",
                        width: 200,
                        sortable: true
                    },
                    {
                        title: "联系方式",
                        key: "mobile",
                        width: 115,
                        sortable: true
                    }],
                data: [], // 表单数据
                total: 0 // 表单数据总数
            }
        },
        methods: {
            init() {
                this.getDataList();
            },
            getDataList() {
                this.loading = true;
                blacklistList(this.searchForm).then(res => {
                    this.loading = false;
                    if (res.status === true) {
                        this.data = res.data.rows;
                        this.total = res.data.total;
                    }
                });
            },  changePage(v) {
                this.searchForm.pageNumber = v;
                this.getDataList();
                this.clearSelectAll();
            },
            changePageSize(v) {
                this.searchForm.pageSize = v;
                this.getDataList();
            }, handleSearch() {
                this.searchForm.pageNumber = 1;
                this.searchForm.pageSize = 10;
                this.getDataList();
            },
            handleReset() {
                this.$refs.searchForm.resetFields();
                this.searchForm.pageNumber = 1;
                this.searchForm.pageSize = 10;
                this.selectDate = null;
                this.searchForm.startDate = "";
                this.searchForm.endDate = "";
                // 重新加载数据
                this.getDataList();
            },
            dropDown() {
                if (this.drop) {
                    this.dropDownContent = "展开";
                    this.dropDownIcon = "ios-arrow-down";
                } else {
                    this.dropDownContent = "收起";
                    this.dropDownIcon = "ios-arrow-up";
                }
                this.drop = !this.drop;
            }
        },
        mounted() {
            this.init();
        }
    }
</script>
